<SCRIPT language="JavaScript" type="text/javascript">
    function submitForm()
    {
        updateRTEs();
        document.getElementById('JobDesc').value=document.getElementById('hdnrtedesc').value;
        document.getElementById('JobJobdesc').value=document.getElementById('hdnrtejobdesc').value;
        document.getElementById('JobCriteria').value=document.getElementById('hdnrtecriteria').value;
        document.getElementById('JobNote').value=document.getElementById('hdnrtenote').value;
        
        var temp="";
        temp=document.getElementById('JobPosition');  
        if( temp.value=='')
        {
            temp.focus();
            temp.style.backgroundColor='#FFC';
            alert('Please provide the position of your adv job');
            temp.style.backgroundColor='#FFF';
            return false;             
        } 

        temp=document.getElementById('JobUrgent');
        if( temp.value=='' && document.getElementById('JobBehaviour').value!='1' )
        {
            temp.focus();
            temp.style.backgroundColor='#FFC';
            alert('Please provide the urgently information');
            temp.style.backgroundColor='#FFF';
            return false;             
        }               
        
        temp=document.getElementById('JobCriteria');
        if( temp.value.length < 20 )
        {
            alert('Please provide the requirement with minimum 20 characters');
            return false;             
        }         
        
        temp=document.getElementById('JobCityId');
        if( temp.value=='' )
        {
            temp.style.backgroundColor='#FFC';
            alert('Please fill the location of this job');
            temp.style.backgroundColor='#FFF';
            temp.focus();
            return false;             
        }     
        
        if (!document.getElementById('JobParttime').checked && !document.getElementById('JobFulltime').checked && !document.getElementById('JobFreelance').checked && !document.getElementById('JobContract').checked && !document.getElementById('JobTemporary').checked )
        {
            alert('Please choose one for the type of work');
            return false;             
        }
        
        if (!document.getElementById('JobEntry').checked && !document.getElementById('JobSenior').checked && !document.getElementById('JobMiddle').checked && !document.getElementById('JobTop').checked  )
        {
            alert('Please choose one for the career level');
            return false;        
        }
       
        var maxxx=3;
        var pilih = 0;
        var c=0;
        for( c = 0; c<document.getElementById('FieldField').length; c+=1) 
        {
            if(document.getElementById('FieldField')[c].selected)
            {
                pilih=pilih+1;
            }    
        }                     

        if (pilih ==0)
        {
            alert('Please choose the type of job field');
            return false;        
        }
        
        if (pilih > maxxx)
        {
            alert("Sorry, you can only choose the type of fields max "+maxxx+" fields");
            return false;        
        }     
    }                                                         
    
    function test()
    {
        var pilih = 0;
        var c=0;
        for( c = 0; c<document.getElementById('FieldField').length; c+=1) 
        {
            if(document.getElementById('FieldField')[c].selected)
            {
                pilih=pilih+1;
            }    
        }                     
        alert(pilih);      
    }
    
   
    function godesc()
    {
        frames['rtedesc'].document.body.innerHTML='<center><span><strong><font size="2" face="trebuchet ms">Due to the Company`s rapidly expanding business; we invite young, energetic and talented person to join our professional team as :</font></strong></span><center>';
    }
    function gojobdesc()
    {
        frames['rtejobdesc'].document.body.innerHTML='<span><ul><li><div class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: 10pt; font-family: Arial;">Planning and leading information system development project</span></div></li><li><div class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: 10pt; font-family: Arial;">Representing company to client during development and implementation phase</span></div></li><li><div class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: 10pt; font-family: Arial;">Able to develop project plan including project scope, schedule, and budget estimation</span></div></li><li><div class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: 10pt; font-family: Arial;">Having sound knowledge of software / system development methodology; knowledge of project management and or system development methodology standards</span></div></li></ul></span>';
    }    
    function gocriteria()
    {
        frames['rtecriteria'].document.body.innerHTML='<span><ul><li><div class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: 10pt; font-family: Arial;">Male/ Female with S1 Degree <br></span></div></li><li><div class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: 10pt; font-family: Arial;">Have 2-3 years of related experience</span></div></li><li><div class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: 10pt; font-family: Arial;">Have excellent team leadership, communication and interpersonal skills</span></div></li><li><div class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: 10pt; font-family: Arial;">Fast learning and able to work under pressure</span></div></li><li><div class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: 10pt; font-family: Arial;">Pleasant personality with good communication, interpersonal &amp; presentation skills</span></div></li><li><div class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: 10pt; font-family: Arial;">Good computer skills (MS Office)</span></div></li><li><div class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: 10pt; font-family: Arial;">Good command of English in both oral and verbal</span></div></li></ul></span>';
    }     
    function gonote()
    {
        frames['rtenote'].document.body.innerHTML='<center><font size="2" face="verdana"><font color="maroon">IF YOU THINK YOUR QUALIFICATION MEETS BELOW, PLASE SEND YOUR RESUME AND SALARY REQUIREMENT TO US AND PROOF IT AS ONE OF OUR PROFESSIONAL.</font></font></center><font size="2" face="verdana"><br><br><li>Good remuneration packet is offered to the right candidate.<br></li><li>Good career path.<br></li><li>Possibility to travel abroad or work overseas.</li><br><br></font><center><font size="2" face="verdana"><font color="blue">Send your Curriculum Vitae to:<br><b> [Your company email] </b><b><br></b></font></font></center> ';
    }     
    function test( data )
    {
        if ( data.id == 'JobEntry' && data.checked)
        {
            document.getElementById('JobMiddle').checked=false;
            document.getElementById('JobSenior').checked=false;
            document.getElementById('JobTop').checked=false;
        }
        if ( data.id == 'JobMiddle' && data.checked)
        {
            document.getElementById('JobEntry').checked=false;
            document.getElementById('JobSenior').checked=false;
            document.getElementById('JobTop').checked=false;
        }    
        if ( data.id == 'JobSenior' && data.checked)
        {
            document.getElementById('JobEntry').checked=false;
            document.getElementById('JobMiddle').checked=false;
            document.getElementById('JobTop').checked=false;
        }
        if ( data.id == 'JobTop' && data.checked)
        {
            document.getElementById('JobEntry').checked=false;
            document.getElementById('JobMiddle').checked=false;
            document.getElementById('JobSenior').checked=false;
        }            
    }
    
    initRTE("../../app/webroot/js/images/", "../../app/webroot/js/", "../../app/webroot/js/");
</SCRIPT>  

<?php                  
echo "<div class='form'>";
echo "<h2> Edit Job </h2>";
echo "<hr color='#2A7EF7'>"; 
    echo ":. Back to ".$html->link('[ My Jobs ]',array('controller'=>'jobs','action'=>'my_jobs'));
    echo "<div class='kotak2'>";
    echo $form->create('Job',array('action'=>'edit','onsubmit'=>'return submitForm();'));
        echo "<div class='input'><label> &nbsp </label>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<span class='red'>*</span> <b>Required Field</b></div>";
            
        echo $form->input('id');
        echo $form->input('template_id');
        echo $form->input('position',array('size'=>40,'after'=>"<span class='red'><sup>*</sup></span>"));
        echo $form->input('urgent',array('label'=>'Attracting Words'));
        echo $form->input('behaviour',array('div'=>false,'label'=>false,'options'=>array('1'=>'none','2'=>'static','3'=>'scroll')));

        
        //echo $form->input('desc', array('type'=>'text','value'=>$this->data['Job']['desc'])); 
        echo $form->input('desc', array('type'=>'hidden'));
        //echo "<input type='hidden' value='".$this->data['Job']['desc']."' id='JobDesc' name='data[Job][desc]'>";
        
        echo "<div class='input'>";  
        echo "<label>Description</label> <input type='button' value='Load Example' onClick='godesc();'>";
        echo "</div>";
    ?>    
<div style='background-color:white'><center>    
<SCRIPT language="JavaScript" type="text/javascript">
    writeRichText('rtedesc', document.getElementById('JobDesc').value, 400, 200, true, false);
</SCRIPT>
</center></div>
    <?php
        echo $form->input('jobdesc', array('type'=>'hidden'));
        echo "<div class='input'>";  
        echo "<label>Job Description</label>  <input type='button' value='Load Example' onClick='gojobdesc();'>";
        echo "</div>"; 
    ?>
<div style='background-color:white'><center>    
<SCRIPT language="JavaScript" type="text/javascript">
    writeRichText('rtejobdesc', document.getElementById('JobJobdesc').value, 400, 200, true, false);
</SCRIPT>
</center></div>
    <?php
        echo $form->input('criteria', array('type'=>'hidden')); 
        echo "<div class='input'>";  
        echo "<label>Requirement / Citeria<span class='red'><sup>*</sup></span></label>  <input type='button' value='Load Example' onClick='gocriteria();'>";
        echo "</div>";        
        
    ?>
<div style='background-color:white'><center>    
<SCRIPT language="JavaScript" type="text/javascript">
    writeRichText('rtecriteria', document.getElementById('JobCriteria').value, 400, 200, true, false);
</SCRIPT>
</center></div>
    <?php
        echo $form->input('note', array('type'=>'hidden')); 
        echo "<div class='input'>";  
        echo "<label>Note</label>  <input type='button' value='Load Example' onClick='gonote();'>";
        echo "</div>";        
    ?>
<div style='background-color:white'><center>
<SCRIPT language="JavaScript" type="text/javascript">
    writeRichText('rtenote', document.getElementById('JobNote').value, 400, 200, true, false);
</SCRIPT>
</center></div>
    <?php
        echo $form->input('city_id',array('empty'=>'','label'=>'Job Location','after'=>"<span class='red'><sup>*</sup></span>"));
        echo $form->input('academic_id',array('label'=>'Academic Qualification'));
        //echo $form->input('experience',array('label'=>'Working Experience','after'=>'year(s)','size'=>'1','maxlength'=>'1'));
        echo $form->input('experience',array('options'=>array('0'=>'0','1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5'), 'label'=>'Working Experience','after'=>'year(s)'));
        
        echo $form->input('salary',array('options'=>array('0'=>SALARY_0,'1'=>SALARY_1,'2'=>SALARY_2,'3'=>SALARY_3,'4'=>SALARY_4)));
        
        echo "<div class='input'><label>Type of work<span class='red'><sup>*</sup></span></label>";
        echo $form->input('parttime', array('div'=>false,'label'=>false))." Part Time <br><label> &nbsp </label>";
        echo $form->input('fulltime', array('div'=>false,'label'=>false))." Full Time <br><label> &nbsp </label>";
        echo $form->input('freelance', array('div'=>false,'label'=>false))." Freelance <br><label> &nbsp </label>";
        echo $form->input('contract', array('div'=>false,'label'=>false))." Contract <br><label> &nbsp </label>";
        echo $form->input('temporary', array('div'=>false,'label'=>false))." Temporary";
        echo "</div>";
        
        echo "<div class='input'><label>Career level<span class='red'><sup>*</sup></span></label>";
        echo $form->input('entry', array('div'=>false, 'onClick'=>'test(this)','label'=>false))." Entry <br><label> &nbsp </label>";
        echo $form->input('middle', array('div'=>false, 'onClick'=>'test(this)','label'=>false))." Middle <br><label> &nbsp </label>";
        echo $form->input('senior', array('div'=>false, 'onClick'=>'test(this)','label'=>false))." Senior <br><label> &nbsp </label>";
        echo $form->input('top', array('div'=>false, 'onClick'=>'test(this)','label'=>false))." Top";
        
        echo $form->input('Field',array('style'=>'height:100px','after'=>"<br><label>&nbsp</label><span class='info'> Hold CTRL to choose more than 1 field</span>"));
        
  
        echo "<div class='input'><label> &nbsp </label><input type='submit' value='Submit'></div>";
    echo "</form>";
    echo "</div>";     

echo "</div>";     
?>
